<template>
    <div class="containers" style="margin-top: 45px;">
        <van-nav-bar
		title="直播升级"
		left-arrow
		@click-left="onClickLeft"
		/>
      
        <div class="day">
            <span>请选择直播天数</span><van-stepper v-model="value" @change="vchange"/>
        </div>
      <van-submit-bar
        :price="price"
        button-text="加入购物车"
        @submit="onSubmit"
        >
        </van-submit-bar>
    </div>
</template>
<script>
export default {
  data () {
    return {
      show: false,
      chosenAddressId: '',
      imageURL: require('../assets/bei.jpg'),
      value: 1,
      price: 10000,
      mid:4,
      goodname:"开通直播",
      goodprice:100,
      goodnum:1,
      gooddesc:"可以添加一段直播视频"
    }
  },
  created () {
      this.mid = JSON.parse(window.localStorage.getItem('item')).id
    //   console.log(this.mid)
  },
  methods: {
      onClickLeft () {
          this.$router.go(-1)
      },
      onSubmit () {
          if (this.$route.query.day >= this.value) {
              this.$toast('请选择大于当前已有天数的天数')
          } else {
              let that = this
            window.localStorage.removeItem('strightVideoDay')
            window.localStorage.setItem('strightVideoDay', this.value)
            this.goodnum = this.value
            this.$axios.get("/huainianwang/shoppingCart/app/addShoppingCart?mid="+this.mid+"&goodname="+this.goodname+"&goodprice="+this.goodprice+"&goodnum="+this.goodnum+"&gooddesc="+this.gooddesc+"")
                    .then(function(res){
                        // alert(1)
                        that.$toast('添加成功,可返回添加直播视频')
                        that.$router.go(-1)
                    },function(err){
                    }).catch(function(error){
                    });
          }
          
      },
      onAdd () {

      },
      vchange () {
          this.price = 10000 * this.value
      }
  }
}
</script>

<style scoped lang="scss">
.day {
    height: 50px;
    line-height: 50px;
    padding: 10px;
}

</style>
<style>
.containers .van-button--large{
    position: static !important;
    background-color: #f44 !important;
    border: 1px solid #f44 !important;
    height: 45px !important;
    width: 50% !important;
    margin-top: 0px !important;
}

</style>

